package com.ym.goods.controller;

import com.ym.goods.entity.GoodsClassEntity;
import com.ym.goods.service.GoodsCommonService;
import com.ym.utils.restful.AjaxJson;
import com.ym.utils.exception.CustomException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@Api(tags = "主体商品模块",value = "商品模块")
@RestController
@RequestMapping("/goodsCommon")
public class GoodsCommonController  {

    @Autowired
    private GoodsCommonService goodsCommonService;

    /**
     * @return
     */
    @ApiOperation(value = "查询信息", notes = "描述：返回Map")
    @ApiParam(name = "",value ="" ,defaultValue = "",required = false)
    @RequestMapping(value = "/get/Infor", method = RequestMethod.POST,produces="application/json;charset=UTF-8")
    public AjaxJson getInfor() throws CustomException {
        AjaxJson ajaxJson =new AjaxJson();
        Map map= new HashMap<>();
        map.put("name","晨曦");
        return ajaxJson.Success(map);
    }


    @ApiOperation(value = "添加信息", notes = "描述：返回Map")
    @ApiParam(name = "",value ="" ,defaultValue = "",required = false)
    @RequestMapping(value = "/add/Infor", method = RequestMethod.POST,produces="application/json;charset=UTF-8")
    public AjaxJson addInfor(@RequestBody GoodsClassEntity goodsClassEntity) throws CustomException {
        AjaxJson ajaxJson =new AjaxJson();
        return ajaxJson.Success(goodsCommonService.addInfor(goodsClassEntity));
    }
}
